package com.wang.todoList.config.url;

import com.wang.todoList.filter.BaseFilter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截选项
 * @author Zifan
 * @date 2021年07月10日21:17
 */
@Configuration
public class UrlFilterConfig implements WebMvcConfigurer{
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        InterceptorRegistration registration = registry.addInterceptor(new BaseFilter());
        registration.addPathPatterns("/**");
        registration.excludePathPatterns(
                "/admin/login",
                "/admin/logout",
                "/admin/register",
                "/admin/captcha",
                "/css/**",
                "/js/**",
                "/index.html",
                "favicon.ico",
                "/doc.html",
                "/webjars/**",
                "/swagger-resources/**",
                "/v2/api-docs/**",
                "/captcha",
                "/ws/**"
        );
    }
}
